﻿<%@ Page Title="Clientes" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Cliente.aspx.cs" Inherits="Follow.Cadastros.Cliente" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="Titulo">
        <%: Title %><br />
        <asp:Image ID="imgTitulo" runat="server" ImageUrl="~/images/linhas_17.png" />
    </div>
    <asp:MultiView ID="mvClientes" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            <div class="subTitulo">
                <asp:Label ID="lblTituloView1" runat="server" Text="Lista de Clientes" />
            </div>
            <div id="divMsg1" class="isa_info" runat="server" visible="false" >
                <asp:Label ID="lblMsg1" runat="server" Text="Mensagem." />
            </div>
            <div class="divPesquisa">
                <asp:Label ID="lblPesquisa" Text="Pesquisa:" runat="server" /><br />
                <asp:TextBox ID="txtPesquisa" runat="server" Width="300px" Height="25px" />
                <asp:Button ID="btnPesquisa" runat="server" Text="Pesquisar" OnClick="btnPesquisa_Click"
                    CssClass="Botao" />
                <asp:Button ID="btnIncluir" runat="server" Text="Incluir" OnClick="btnIncluir_Click"
                    CssClass="Botao" /><br />
                <asp:CheckBox ID="ckbPesquisa" runat="server" Text="Mostrar inativos" CssClass="checkBox" />
            </div>
            <br />
            <asp:GridView ID="gvClientes" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                DataKeyNames="IDCliente" OnRowCommand="gvClientes_RowCommand" Width="765px" BackColor="White"
                BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black"
                GridLines="Vertical" OnSelectedIndexChanged="gvClientes_SelectedIndexChanged">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField HeaderText="Nome" DataField="Nome" />
                    <asp:BoundField HeaderText="CNPJ" DataField="CNPJ" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Cidade" DataField="Cidade" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Estado" DataField="Estado" ItemStyle-HorizontalAlign="Center" />
                    <asp:CheckBoxField HeaderText="Ativo" DataField="Ativo" ItemStyle-HorizontalAlign="Center" />
                    <asp:ButtonField ButtonType="image" ImageUrl="~/Images/editar.png" CommandName="Editar"
                        HeaderText="Editar" ItemStyle-HorizontalAlign="Center" />
                    <asp:ButtonField ButtonType="image" ImageUrl="~/Images/excluir.png" CommandName="Excluir"
                        HeaderText="Excluir" ItemStyle-HorizontalAlign="Center" />
                    <asp:ButtonField ButtonType="image" ImageUrl="~/Images/contato.png" CommandName="Contatos"
                        HeaderText="Contatos" ItemStyle-HorizontalAlign="Center" />
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#F7F7DE" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />
            </asp:GridView>
            <asp:Label ID="lblMsgGridClientes" runat="server" Text="Nenhum registro encontrado."
                Visible="false"></asp:Label>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <div class="subTitulo">
                <asp:Label ID="lblTituloView2" runat="server" Text="Editar cliente" />
            </div>
            <div id="divMsg2" class="isa_info" runat="server" visible="false" >
                <asp:Label ID="lblMsg2" runat="server" Text="Mensagem." />
            </div>
            <asp:HiddenField ID="IDCliente" runat="server" />
            <asp:Label ID="lblNome" runat="server" Text="Nome:" />
            <br />
            <asp:TextBox ID="txtNome" runat="server" />
            <asp:RequiredFieldValidator ID="rfvNome" runat="server" ErrorMessage="* Campo Nome não preenchido."
                ForeColor="Red" ControlToValidate="txtNome" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblCnpj" runat="server" Text="CNPJ:" />
            <br />
            <asp:TextBox ID="txtCnpj" runat="server" />
            <asp:RequiredFieldValidator ID="rfvCnpj" runat="server" ErrorMessage="* Campo CNPJ ou CPF não preenchido."
                ForeColor="Red" ControlToValidate="txtCnpj" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="revCnpjCadastro" runat="server" ControlToValidate="txtCnpj"
                Font-Size="X-Small" ForeColor="Red" ErrorMessage="* Campo CNPJ inválido." ValidationExpression="(^(\d{2}.\d{3}.\d{3}/\d{4}-\d{2})|(\d{14})$)"></asp:RegularExpressionValidator>
            <asp:MaskedEditExtender ID="txtCnpj_MaskedEditExtender" runat="server" AutoComplete="false"
                ClearMaskOnLostFocus="False" Mask="99\.999\.999\/9999\-99" MaskType="Number"
                TargetControlID="txtCnpj">
            </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblCidade" runat="server" Text="Cidade:" />
            <br />
            <asp:TextBox ID="txtCidade" runat="server" />
            <asp:RequiredFieldValidator ID="rfvCidade" runat="server" ErrorMessage="* Campo Cidade não preenchido."
                ForeColor="Red" ControlToValidate="txtCidade" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblEstado" runat="server" Text="Estado:" />
            <br />
            <asp:TextBox ID="txtEstado" runat="server" />
            <asp:RequiredFieldValidator ID="rfvEstado" runat="server" ErrorMessage="* Campo Estado não preenchido."
                ForeColor="Red" ControlToValidate="txtEstado" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <asp:CheckBox ID="ckbAtivo" runat="server" Text="Ativo" CssClass="checkBox" Checked="true" /><br />
            <br />
            <div class="listaDeContatos" id="divContatos" runat="server">
                <asp:Label ID="lblContatos" Text="Contatos" CssClass="subTitulo" runat="server" />
                <asp:GridView ID="gvContatos" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    DataKeyNames="IDContato" OnRowCommand="gvContatos_RowCommand" 
                    Width="765px" BackColor="White"
                    BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black"
                    GridLines="Vertical" 
                    onselectedindexchanged="gvContatos_SelectedIndexChanged">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField HeaderText="Nome" DataField="Nome" />
                        <asp:BoundField HeaderText="Departamento" DataField="Dpto" ItemStyle-HorizontalAlign="Center" />
                        <asp:BoundField HeaderText="Telefone" DataField="Tel1" ItemStyle-HorizontalAlign="Center" />
                        <asp:BoundField HeaderText="E-Mail" DataField="Email" ItemStyle-HorizontalAlign="Center" />
                        <asp:BoundField HeaderText="Login" DataField="NomeUsuario" ItemStyle-HorizontalAlign="Center" />
                        <asp:ButtonField ButtonType="image" ImageUrl="~/Images/editar.png" CommandName="Editar"
                            HeaderText="Editar" ItemStyle-HorizontalAlign="Center" />
                        <asp:ButtonField ButtonType="image" ImageUrl="~/Images/excluir.png" CommandName="Excluir"
                            HeaderText="Excluir" ItemStyle-HorizontalAlign="Center" />
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" />
                    <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <RowStyle BackColor="#F7F7DE" />
                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#FBFBF2" />
                    <SortedAscendingHeaderStyle BackColor="#848384" />
                    <SortedDescendingCellStyle BackColor="#EAEAD3" />
                    <SortedDescendingHeaderStyle BackColor="#575357" />
                </asp:GridView>
                <asp:Label ID="lblMsgGridContatos" runat="server" Text="Nenhum registro encontrado."
                    Visible="false" /><br />
                <asp:Button ID="btnIncluirContato" runat="server" Text="Incluir contato" OnClick="btnIncluirContato_Click"
                    CssClass="Botao" />
            </div>
            <br />
            <center>
                <asp:Button ID="btnSalvar" runat="server" Text="Salvar" OnClick="btnSalvar_Click"
                    CssClass="Botao" />
                <asp:Button ID="btnVoltar" runat="server" Text="Voltar" OnClick="btnVoltar_Click"
                    CssClass="Botao" CausesValidation="false" />
            </center>
            <br />
        </asp:View>
        <asp:View ID="View3" runat="server">
            <div class="subTitulo">
                <asp:Label ID="lblTituloView3" runat="server" Text="Editar contato" />
            </div>
            <br />
            <div id="divMsg3" class="isa_info" runat="server" visible="false" >
                <asp:Label ID="lblMsg3" runat="server" Text="Mensagem." />
            </div>
            <br />
            <asp:HiddenField ID="IDContato" runat="server" />
            <asp:HiddenField ID="IDClienteContato" runat="server" />
            <asp:Label ID="lblNomeContato" runat="server" Text="Nome:" />
            <br />
            <asp:TextBox ID="txtNomeContato" runat="server" />
            <asp:RequiredFieldValidator ID="rfvNomeContato" runat="server" ErrorMessage="* Campo Nome não preenchido."
                ForeColor="Red" ControlToValidate="txtNomeContato" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblDepto" runat="server" Text="Departamento:" />
            <br />
            <asp:TextBox ID="txtDepto" runat="server" />
            <asp:RequiredFieldValidator ID="rfvDepto" runat="server" ErrorMessage="* Campo Departamento não preenchido."
                ForeColor="Red" ControlToValidate="txtDepto" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblEmail" runat="server" Text="Email:" />
            <br />
            <asp:TextBox ID="txtEmail" runat="server" />
            <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ErrorMessage="* Campo Email não preenchido."
                ForeColor="Red" ControlToValidate="txtEmail" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblTel1" runat="server" Text="Tel 1:" />
            <br />
            <asp:TextBox ID="txtTel1" runat="server" />
            <asp:RequiredFieldValidator ID="rfvTel1" runat="server" ErrorMessage="* Campo Tel 1 não preenchido."
                ForeColor="Red" ControlToValidate="txtTel1" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblTel2" runat="server" Text="Tel 2:" />
            <br />
            <asp:TextBox ID="txtTel2" runat="server" />
            <asp:RequiredFieldValidator ID="rfvTel2" runat="server" ErrorMessage="* Campo Tel 2 não preenchido."
                ForeColor="Red" ControlToValidate="txtTel2" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblUsuario" runat="server" Text="Usuário:" />
            <br />
            <asp:DropDownList ID="ddlUsuario" runat="server">
            </asp:DropDownList>
            <br />
            <br />
            <asp:Button ID="btnSalvarContato" runat="server" Text="Salvar" OnClick="btnSalvarContato_Click"
                CssClass="Botao" />
            <asp:Button ID="btnVoltarContato" runat="server" Text="Voltar" OnClick="btnVoltarContato_Click"
                CssClass="Botao" CausesValidation="false" />
            <br />
        </asp:View>
    </asp:MultiView>
</asp:Content>
